class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int length = nums.size();
        int item = nums[0];
        int index = 0;
        for(int i = 0; i< length; i++)
        {
            if(nums[i] != item)
            {
                index += 1;
                nums[index] = nums[i];
                item = nums[i];
            }
            else
            {
                continue;
            }
        }
        return index + 1;
    }
};